<?php
class text extends module
{
function content_init()
	{
    global $common_data_server;
    $content_text_row=sql_select("SELECT * FROM CONTENT_MAP,CONTENT_TEXT WHERE CONTENT_MAP.INF_BLOCK_ID=".$this->block_id." AND CONTENT_TEXT.CONTENT_ID=CONTENT_MAP.CONTENT_ID AND CONTENT_TEXT.VERSION=".$this->version." AND CONTENT_TEXT.LANG_ID=".$this->lang_id);
	$template=$common_data_server."module_templates/text/".$this->view_param["template"]."/text.vtmpl";
    if(file_exists($template))
	    {
        $content_tmpl=new vlibTemplate();
		$content_tmpl->newTemplate($template);
		$items=array();

		if($this->view_param["header"]==1)$title=$content_text_row[0]["TITLE"];
			else $title="";
		$content_text_row[0]["title"]=$title;
		$content_text_row[0]["body"]=$content_text_row[0]["BODY"];

		$content_tmpl->hash2vlib($content_text_row[0]);
        
		if($this->is_print==1)$content_tmpl->setVar("is_print",1);
   	    elseif($this->view_param["is_printable"]=="yes")
			$content_tmpl->setVar("printable_url","printable.php?".make_query_string(array("print"=>"1")));
		$this->body=$content_tmpl->grab();
        }
	else
		{
        $this->body="Шаблон отсутствует: ".$template;
        }
    $this->title = ($this->view_param['header'] == 1) ? $content_text_row[0]['TITLE'] : '';
    }
}
?>